import type { EChartsOption } from "echarts";
import * as echarts from 'echarts/core'

export function getOption(): EChartsOption {
  return  {
    //你的代码
    tooltip: {
      trigger: 'axis',
      backgroundColor: 'rgba(12, 36, 30,0.5)',
      textStyle: {
        color: "#fff"
      },
      axisPointer: {
        type: 'shadow'
      }
    },

    grid: {
      top: '20%',
      left: '2%',
      right: '2%',
      bottom: '5%',
      containLabel: true
    },
    xAxis: [{
      type: 'category',
      data: ['2018', '2019', '2020', '2021', '2022'],
      axisLine: {
        show: false,
        lineStyle: {
          color: "#063374",
          width: 1,
          type: "solid"
        }
      },
      axisTick: {
        show: false,
      },
      axisLabel: {
        show: true,
        color: 'rgba(255,255,255,0.8)',
        fontSize: 14
      },
    }],
    yAxis: [{
      type: 'value',
      axisLabel: {
        formatter: '{value}',
        color: 'rgba(255,255,255,0.8)',
        fontSize: 14
      },
      axisTick: {
        show: false,
      },
      axisLine: {
        show: false,
        lineStyle: {
          color: "#063374",
          width: 1,
          type: "solid"
        },
      },
      splitLine: {
        lineStyle: {
          color: "#063374",
          type: "dashed"
        }
      }
    }],
    series: [{
      name: '较好',
      type: 'bar',
      data: [22, 20, 25, 28, 25, 22],
      barWidth: 14,
      barGap: 1,
      itemStyle: {
        color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [{
          offset: 0,
          color: '#FEC060'
        }, {
          offset: 1,
          color: 'rgba(254, 192, 96, 0.1)'
        }]),
        opacity: 1,
        borderRadius: [30,30,0,0],
      }
    }]
  };
}
